Description: 用非递归实现快速排序
主要思想:
利用栈来消除递归-Non-recursive quicksort implementation the main idea: to eliminate the use of recursive stack Platform: |
Size: 11264 |
Author:weixiaoguoke |
Hits:
Description: 此文件夹中共包括十二个小程序
AVL创建平衡二叉树,通过加入一个个的结点创建,并实现了平衡二叉树中的结点删除
Boyer_Moore算法的串模式匹配
Horspool算法的串模式匹配
Graph实现了有向图的非递归广度优先遍历及非递归深度优先遍历
HeapSort利用堆排序实现优先级队列
Merge实现二路归并排序算法
MFK动态规划解背包问题
nqueue求解n皇后问题
QuickSort快速排序算法的实现。
Shell排序算法的实现。
Tree程序中实现了先序\中序\后序遍历二叉树的非递归算法。
tubao用递归法解决突包问题-This folder, including the Chinese Communist AVL applet 12 to create a balanced binary tree, by adding a node to create, and achieving a balanced binary tree of nodes to delete Boyer_Moore algorithm Horspool string pattern matching the string pattern-matching algorithm Graph to achieve a directed graph breadth-first traversal non-recursive and non-recursive depth-first traversal HEAPSORT HeapSort use to achieve the realization of priority queue Merge merge sorting algorithm Road MFK knapsack problem dynamic programming solution of n queen problem solving nqueue rapid QuickSort sort algorithm. Shell Sort Algorithm. Tree process sequence to achieve the first \ in the sequence \ after the sequence of the non-recursive binary tree traversal algorithm. tubao recursive method used to solve the issue of sudden package Platform: |
Size: 374784 |
Author:zouyan |
Hits:
Description: 快速排序(快速排序)是一种快速排序算法,它被广泛应用于实践。它是用于分而治之的原则。快速排序的工作原理是划分一个给定的数组A [P。 。 R]分成两个非空的子阵列A [页。 。 Q]和A [Q + 1。 。 R]使得在[P每个元素。 。问]是小于或等于每个元素A [Q + 1。 。 R]。然后两个子阵列被递归调用快速排序排序。快速排序的细节描述如下:
1.选择一个支点值(基准)。您可以采取的第一个元素的值
枢轴值,但它可以是任何值,这是在排序的值的范围,即使它不存在于阵列中。
2.分区(划分)。重新排列以这样的方式是比所述枢轴更低所有元素去阵列的左侧部分的元素,并且比枢轴更大所有元素去阵列的右侧部分。值等于枢轴可以留在阵列的任何位置。
3.排序两个子阵列。递归地应用快速排序算法的左侧和所述阵列的右侧部分。编写一个函数模板快速排序下Fig.8.15的排序程序的参考,同时也写输入,排序和输出int数组和一个float数组元素的8潜水员程序-quickSort(快速排序) is a fast sorting algorithm, which is widely applied in practice. It is used on the principle of divide-and-conquer. quickSort works by partitioning a given array A[p . . r] into two non-empty sub-arrays A[p . . q] and A[q+1 . . r] such that every element in A[p . . q] is less than or equal to every element in A[q+1 . . r]. Then the two sub-arrays are sorted by recursive calls to quickSort. The details of quickSort are described as follows:
1. Choose a pivot value(基准). You may take the value of the first element as
pivot value, but it can be any value, which is in range of sorted values, even if it doesn t present in the array.
2. Partition(划分). Rearrange elements in such a way that all elements which are lesser than the pivot go to the left part of the array, and all elements greater than the pivot go to the right part of the array. Values equal to the pivot can stay in any position of the array.
3. Sort both sub-arrays. Apply quicksort algorithm recursively to the Platform: |
Size: 11264 |
Author:lefter |
Hits: